<extend name="Shops:layout" />
<block name="content">
<style type="text/css">
#preview{border:1px solid #cccccc; background:#CCC;color:#fff; padding:5px; display:none; position:absolute;}
</style>

<script>
$(document).ready(function(){
    $('.imgPreview').imagePreview();
    <notempty name='shopCatId1'>
    getShopCatListForGoods('{$shopCatId1}','{$shopCatId2}');
    </notempty>
});
</script>

    <div class="wst-body">
       <div class='wst-page-header'>卖家中心 > 团购活动</div>
       <div class='wst-page-content'>
        <div class='wst-tbar-query' style="width:850px;">
        分类：<select id='shopCatId1' autocomplete="off" onchange='javascript:getShopCatListForGoods(this.value,"{$object['shopCatId2']}")'>
           <option value='0'>请选择</option>
           <volist name="shopCatsList" id="vo">
           <option value='{$vo['catId']}' <if condition="$shopCatId1 == $vo['catId'] ">selected</if>>{$vo['catName']}</option>
           </volist>
       </select>
       <select id='shopCatId2' autocomplete="off">
           <option value='0'>请选择</option>
       </select>
        名称：<input type='text' id='goodsName' value='{$goodsName}'/>
        审核状态：
          <select id='goodsGroupStatus'>
            <option value='-1' <if condition="$goods['goodsGroupStatus'] eq -1">selected</if> >全部</option>
            <option value='1' <if condition="$goods['goodsGroupStatus'] eq 1">selected</if> >已审核</option>
            <option value='0' <if condition="$goods['goodsGroupStatus'] eq 0">selected</if> >未审核</option>
          </select>
        活动状态：
          <select id='groupStatus'>
               <option value='-1' <if condition="$goods['groupStatus'] eq -1">selected</if> >全部</option>
               <option value='0' <if condition="$goods['groupStatus'] eq 0">selected</if>>未开始</option>
               <option value='1' <if condition="$goods['groupStatus'] eq 1">selected</if>>进行中</option>
               <option value='2' <if condition="$goods['groupStatus'] eq 2">selected</if>>成功结束</option>
               <option value='3' <if condition="$goods['groupStatus'] eq 3">selected</if>>失败结束</option>
          </select>
        <button class='wst-btn-query' onclick='javascript:queryGroup()'>查询</button>
        </div>
        <table class='wst-list'>
           <thead>
             <tr>
               <th width='40'>序号<!--<input type='checkbox' onclick='javascript:checkAll(this)'/>--></th>
               <th>商品名称</th>
               <th width="60">审核状态</th>
               <th width="60">活动状态</th>
               <th width="120">结束时间</th>
               <th width="80" >团购价</th>
               <th width="60" >最少团购</th>
               <th width="60" >限购<br/></th>
               <th width="60" >已购<br/></th>
               <th width='110'>操作</th>
             </tr>
           </thead>
           <tbody>
            <volist name="goods['root']" id="vo" key='i'>
             <tr>
               <td>{$i}<!--<input class='chk' type='checkbox' value='{$vo['goodsId']}'/>--></td>
               <td <if condition="$vo['goodsThums'] neq ''">img='/{$vo['goodsThums']}' class='imgPreview'</if>>
               <img class='lazyImg' src="/{$vo['goodsThums']}" data-original="__ROOT__/{$vo['goodsThums']}" height="50" width="50"/>
               {$vo['goodsName']}
               </td>
               <td>
                   <if condition="$vo['goodsGroupStatus'] eq 0">未审核</if>
                   <if condition="$vo['goodsGroupStatus'] eq 1">已审核</if>
               </td>
               <td>
                   <if condition="$vo['groupStatus'] eq 0">未开始</if>
                   <if condition="$vo['groupStatus'] eq 1">进行中</if>
                   <if condition="$vo['groupStatus'] eq 2">成功结束</if>
                   <if condition="$vo['groupStatus'] eq 3">失败结束</if>
               </td>
               <td>
                   <PHP>echo date('Y-n-d H:i:s',$vo['endTime'])</PHP>
               </td>
               <td>
                    {$vo['groupPrice']}
               </td>
               <td>
                    {$vo['groupMinCount']}{$vo['goodsUnit']}
               </td>
               <td  >
                    {$vo['groupMaxCount']}{$vo['goodsUnit']}
               </td>
               <td style="cursor:pointer;"  onclick="javascript:queryGroupOrders({$vo['id']})">
                    <a>{$vo['totalNums']}{$vo['goodsUnit']}</a>
               </td>
               <td>
               <a href="javascript:queryGroupOrders({$vo['id']})" >订单</a> |
               <!--<a href="{:U('Home/Group/getGoodsDetails',array('goodsId'=>$vo['goodsId'],'id'=>$vo['id'],'isGroup'=>1))}" >详情</a> |-->
               <a href="javascript:toEditGoods({$vo['goodsId']},'queryOnSaleByPage')">修改</a>
               &nbsp;
               </td>
             </tr>
             </volist>
             <tfoot>
             <tr>
                <td colspan='12'>
                <div class="wst-page" style="float:right;padding-bottom:10px;">
            <div id="wst-page-items"></div>
        </div>
                <script>
			    <if condition="$goods['totalPage'] gt 1">
			    $(document).ready(function(){
					laypage({
					    cont: 'wst-page-items',
					    pages: {$goods['totalPage']}, //总页数
					    skip: true, //是否开启跳页
					    skin: '#e23e3d',
					    groups: 3, //连续显示分页数
					    curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
					        var page = location.search.match(/p=(\d+)/);
					        return page ? page[1] : 1;
					    }(),
					    jump: function(e, first){ //触发分页后的回调
					        if(!first){ //一定要加此判断，否则初始时会无限刷新
					        	var nuewurl = WST.splitURL("p");
					        	var ulist = nuewurl.split("?");
					        	if(ulist.length>1){
					        		location.href = nuewurl+'&p='+e.curr;
					        	}else{
					        		location.href = '?p='+e.curr;
					        	}

					        }
					    }
					});
			    });
				</if>
				</script>
                </td>
             </tr>
             </tfoot>
           </tbody>
        </table>
        </div>
    </div>
</block>